<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- Bootstrap -->
    <link href="__STATIC__/admin/assets/css/vendor/bootstrap/bootstrap.min.css" rel="stylesheet">
    <!--引入图标样式-->
    <link rel="stylesheet" href="__STATIC__/admin/assets/font-awesome/css/font-awesome.min.css">
    <!--引入复选框样式-->
    <link rel="stylesheet" href="__STATIC__/admin/assets/css/vendor/bootstrap-checkbox.css">
    <!--引入下拉表单-->
    <link rel="stylesheet" href="__STATIC__/admin/bootstrap-select/dist/css/bootstrap-select.css">
    <!--引入自定义样式-->
    <link href="__STATIC__/admin/assets/css/addorder.css?v=1.0" rel="stylesheet">
    <!--引入日志时间轴样式-->
    <link href="__STATIC__/admin/assets/css/order_log.css" rel="stylesheet">

</head>
<style>
    .input-group[class*=col-]{
        float: left;
        margin-top: 20px;
    }
    [class*="col-"]{
        padding-right: 0;
        padding-left: 0;
    }
    .form-control,.input-group-addon{
        border-radius: 0;
        padding: 6px;
        background-color: #fff;
    }
    .radio label:after {
        font-size: 13px;
        content: "";
        text-align: center;
        display: inline-block;
        width: 16px;
        height: 16px;
        position: absolute;
        -o-transform: scale(0);
        -ms-transform: scale(0);
        -moz-transform: scale(0);
        -webkit-transform: scale(0);
        transform: scale(0);
        border-radius: 99px;
        left: 0px;
        top: 0px;
        background-color: #000;
        border: 1px solid #6f7b8a;
    }
    .radio, .checkbox{
        padding-left: 20px;
    }
    .radio-transparent label{
        line-height: 17px;
    }
    .alert-red{

        color: #ff4a43;
        background-color: #ffdddc;
        border-color: #ffaca9;
    }
    .alert-red small{
        padding: 5px  10px;
        margin-top: 0px;
    }
    .input-group{
        position: relative;
        /*border:1px solid red;*/
    }
    .has-error .input-group-addon{
        border-color: red;
    }
    .has-error .form-control{
        border-color: red;
        border-left:1px solid red;
    }
    .has-error small.help-block,small.help-block{
        position: absolute;
        top: 30px;
        left: 0;
        right: 0;
        color: red;
    }
    .tab-pane ul.dropdown-menu{
        position: absolute;
        background: #fff;
        left: 0;
        z-index: 99999;
        border: 1px solid #ccc;
        min-width: 50px;
    }
    .layui-input-inline{
        width: 100%;
    }
    .history{
        border-top: 1px solid #b1b1b1;
        border-bottom: none !important;
    }
    .no-back{
        background: none;
        border: 0;
    }
    .dropdown-menu{
        max-height: 250px;
        overflow-y: auto;
    }
    .dropdown-menu li a img{
        width: 20px;
        margin-right: 10px;
    }
    .dropdown-toggle .title img{
        width: 20px;
        margin-right: 5px;
    }
    .dropdown-toggle{
        text-align: left;
    }
    .caret{
        float: right;
        margin-top: 8px;
    }
    /* 设置滚动条的样式 */
    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    /* 滚动槽 */
    ::-webkit-scrollbar-track {
        /*  -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);*/
        background-color: #f2f4f8;
    }

    ::-webkit-scrollbar-button {
        width: 12px;
        height: 0px;
        background-color: rgba(50, 50, 50, 0.05);
    }

    /* 滚动条滑块 */
    ::-webkit-scrollbar-thumb {
        background-color: rgba(50, 50, 50, 0.25);
        border: 2px solid transparent;
        border-radius: 10px;
        background-clip: padding-box;
    }

    ::-webkit-scrollbar-thumb:hover {
        background-color: #999;
    }

    ::-webkit-scrollbar-thumb:window-inactive {
        background: #fff;

    }
    .bootstrap-select button{
        max-width: 130px;
    }
    .btn-default:hover, .btn-default:focus, .btn-default.focus, .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default{
        background: transparent;
        border-radius: 0;
        /*border: 1px solid #ccc;*/
        border-color: #cccccc;
        border-left: 0;
    }
    .bootstrap-select button{
        outline: none !important;
    }
    .btn-default{
        border-radius: 0;
        border-color: #cccccc;
        /*border: 1px solid #ccc !important;*/
        border-left: 0;
    }
    .btn_box .btn-default{
        border:1px solid #cccccc;
        border-radius: 3px;
    }
</style>
<body>
<div class="addorder">
    <div class="panel-body" style="padding-bottom: 80px;">
        <!-- Nav tabs -->
        <ul class="nav nav-tabs">
            <li class="active">
                <a href="#home1" data-toggle="tab" aria-expanded="true">客资基本信息</a>
            </li>
            <li class="" style="display: none;">
                <a href="#profile1" data-toggle="tab" aria-expanded="false">转介绍客资</a>
            </li>
        </ul>
        <!-- Tab panes -->
        <div class="tab-content">
            <div class="tab-pane fade  active in" id="home1">
                <form class="form-horizontal" role="form" id="ser_form"  data-validator-option="{timely:2,showOk:''}">
                    <div class="alert-red" id="error_box">
                    </div>
                    <input type="hidden" name="addtype" id="typs" value="1">
                    <!---->
                    <div class="col-xs-12" style="height: 15px;margin-top: 5px;">
                        <span style="color: #b824e6;background-color: #fff;">主要联系人</span>
                        <div style="width: 100%;margin-top: -8px;border-top: 1px solid #b824e6;"></div>
                    </div>
                    <!---->
                    <div class="col-xs-12">
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right" name="name_z" placeholder="主要联系人">
                            <div class="input-group-addon" style="padding: 6px;">
                                <div class="btn-group">
                                    <button type="button"  class="dropdown-toggle no-back" data-toggle="dropdown" style="border-left: 0;">
                                        <span class="title"><i class="fa fa-question-circle-o" aria-hidden="true"></i></span>
                                        <input type="hidden" name="gender_z" value="">
                                    </button>
                                    <ul class="dropdown-menu sex" role="menu">
                                        <li><a href="javascript:;" id="0"><i class="fa fa-venus" aria-hidden="true"></i></a></li>
                                        <li><a href="javascript:;" id="1"><i class="fa fa-mars" aria-hidden="true"></i></a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right no-bor-left" name="phone_z" id="phone" placeholder="主要联系电话" >
                            <div class="input-group-addon"><i class="fa fa-phone" aria-hidden="true"></i></div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control  no-bor-right no-bor-left" name="wechat" id="wechat" placeholder="联系微信">
                            <div class="input-group-addon" style="padding: 6px;">
                                <div class="btn-group">
                                    <button type="button"  class="dropdown-toggle no-back" data-toggle="dropdown" style="border-left: 0;">
                                        <span class="title"><i class="fa fa-wechat" aria-hidden="true" style="color: red;"> 未加</i></span>
                                        <input type="hidden" name="jwxtype" value="0">
                                    </button>
                                    <ul class="dropdown-menu sex" role="menu">
                                        <li><a href="javascript:;" id="0"><i class="fa fa-wechat" aria-hidden="true" style="color: red;"> 未加</i></a></li>
                                        <li><a href="javascript:;" id="1"><i class="fa fa-wechat" aria-hidden="true"> 已加</i></a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control  no-bor-right no-bor-left" name="qq" placeholder="联系QQ">
                            <div class="input-group-addon"><i class="fa fa-qq" aria-hidden="true"></i></div>
                        </div>
                    </div>
                    <!--备用联系人-->
                    <div class="col-xs-12" style="height: 15px;margin-top: 5px;">
                        <span style="color: #54a1e6;background-color: #fff;">备用联系人</span>
                        <div style="width: 100%;margin-top: -8px;border-top: 1px solid #54a1e6;"></div>
                    </div>
                    <div class="col-xs-12">
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control  no-bor-right" name="name_f" placeholder="备用联系人">
                            <div class="input-group-addon" style="padding: 6px;">
                                <div class="btn-group">
                                    <button type="button"  class="dropdown-toggle no-back" data-toggle="dropdown" style="border-left: 0;">
                                        <span class="title"><i class="fa fa-question-circle-o" aria-hidden="true"></i></span>
                                        <input type="hidden" name="gender_f" value="">
                                    </button>
                                    <ul class="dropdown-menu sex" role="menu">
                                        <li><a href="javascript:;" id="0"><i class="fa fa-venus" aria-hidden="true"></i></a></li>
                                        <li><a href="javascript:;" id="1"><i class="fa fa-mars" aria-hidden="true"></i></a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right no-bor-left" name="phone_f" placeholder="备用电话">
                            <div class="input-group-addon"><i class="fa fa-phone" aria-hidden="true"></i></div>
                        </div>
                    </div>
                    <!--宝宝信息-->
                    <div class="col-xs-12" style="height: 15px;margin-top: 5px;">
                        <span style="color: #4ec3cc;background-color: #fff;">宝宝信息</span>
                        <div style="width: 100%;margin-top: -8px;border-top: 1px solid #4ec3cc;"></div>
                    </div>
                    <div class="col-xs-12">
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right" name="bbname" placeholder="宝宝姓名">
                            <div class="input-group-addon" style="padding: 6px;">
                                <div class="btn-group">
                                    <button type="button" class="dropdown-toggle no-back" data-toggle="dropdown" style="border-left: 0;">
                                        <span class="title"><i class="fa fa-user-circle" aria-hidden="true"></i></span>
                                        <input type="hidden" name="gender_b">
                                    </button>
                                    <ul class="dropdown-menu sex" role="menu">
                                        <li><a href="javascript:;" id="0"><i class="fa fa-venus" aria-hidden="true"></i></a></li>
                                        <li><a href="javascript:;" id="1"><i class="fa fa-mars" aria-hidden="true"></i></a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right no-bor-left" name="bbcstime" id="data2" placeholder="出生日期">
                            <div class="input-group-addon"><i class="fa fa-birthday-cake" aria-hidden="true"></i></div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right no-bor-left" name="bbage" placeholder="宝宝年龄">
                            <div class="input-group-addon"><i class="fa fa-telegram" aria-hidden="true"></i></div>
                        </div>
                    </div>
                    <div class="col-xs-12" style="height: 15px;margin-top: 5px;">
                        <span style="color: #5db95d;background-color: #fff;">其他信息</span>
                        <div style="width: 100%;margin-top: -8px;border-top: 1px solid #5db95d;"></div>
                    </div>
                    <div class="col-xs-12">
                        <div class="col-md-4  col-xs-4" style="margin-left: 1px;">
                            <div class="input-group form-group col-md-5  col-xs-5">
                                <div class="btn-group" style="line-height: 20px;">
                                <span type="button" class="dropdown-toggle form-control"  style="border-right: 0 !important;text-align: center;">
                                    渠道：
                                </span>
                                </div>
                            </div>
                            <div class="input-group form-group col-md-7  col-xs-7">
                                <div class="btn-group">
                                    <select id="channels" name="channel" class="selectpicker" data-live-search="true" data-size="8" style="border-left: 0;" title="请选择渠道">
                                        {volist name='channel' id='data'}
                                        <option class="select-li" value="{$data.id}" title="<img src='{$data.path}' width='20px' height='20px'>&nbsp;{$data.title}" data-content="<img src='{$data.path}' width='20px' height='20px'>{$data.title}">{$data.title}</option>
                                        {/volist}
                                    </select>
                                    <!--<button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" style="border-right: 0 !important;border-left: 0;">-->
                                        <!--<span class="title qudao-style"><img src="{$channel[0]['path']}">{$channel[0]['title']}</span><span class="caret"></span>-->
                                        <!--<input type="hidden" name="channel" id="channels" value="{$channel[0]["id"]}">-->
                                    <!--</button>-->
                                    <!--<ul class="dropdown-menu cheannele" role="menu">-->
                                        <!--{volist name='channel' id='data'}-->
                                        <!--<li><a href="javascript:;" id="{$data.id}"><img src="{$data.path}">{$data.title}</a></li>-->
                                        <!--{/volist}-->
                                    <!--</ul>-->
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4  col-xs-4" style="margin-left: -1px;">
                            <div class="input-group form-group col-md-5  col-xs-5">
                                <div class="btn-group">
                                <span type="button" class="dropdown-toggle form-control"  style="border-right: 0;text-align: center;margin-left: -2px">
                                    来源：
                                </span>
                                </div>
                            </div>
                            <div class="input-group form-group col-md-7 col-xs-7">
                                <div class="btn-group">
                                    <select name="source" id="source0" class=" form-control" style="border-left: 0;margin-left: -2px;">
                                        {eq name="data.source" value=""}
                                        <option value="0" >来源</option>
                                        {else/}
                                        <option value="{$data.source}">{$data.source_text}</option>
                                        {/eq}
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4  col-xs-4" style="display: none;margin-left: -1px;" id="banjishow">
                            <div class="input-group form-group col-md-5 col-xs-5">
                                <div class="btn-group">
                                <span type="button" class="dropdown-toggle form-control" style="border-right: 0;text-align: center;margin-left: -2px">
                                    班级：
                                </span>
                                </div>
                            </div>
                            <div class="input-group form-group col-md-7 col-xs-7">
                                <div class="btn-group">
                                    <select name="banji" id="banji" class="form-control" style="border-left: 0;margin-left: -2px;">
                                        <option value="0" >班级</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4 col-xs-4" style="margin-left: -1px;display: none;" id="shangkeriqi">
                            <div class="input-group form-group col-md-6  col-xs-6">
                                <div class="btn-group" style="line-height: 20px;">
                                    <span type="button" class="dropdown-toggle form-control"  style="border-right: 0 !important;text-align: center;">
                                        上课日期：
                                    </span>
                                </div>
                            </div>
                            <div class="input-group form-group col-md-6 col-xs-6">
                                <div class="btn-group">
                                    <select name="xingqi" id="xingqiri" class="form-control" style="border-left: 0;margin-left: -2px;">
                                        <option value="0" >请选择星期</option>
                                        {volist name='xingqi' id='vo'}
                                        <option value="{$vo}" {if condition="$data['xingqi']== $vo"} selected="selected" {else}{/if}>{$vo}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-4 col-xs-4" style="margin-left: -1px;display: none;" id="xingqi">
                            <div class="input-group form-group col-md-6  col-xs-6">
                                <div class="btn-group" style="line-height: 20px;">
                                    <span type="button" class="dropdown-toggle form-control"  style="border-right: 0 !important;text-align: center;">
                                        上课时间段：
                                    </span>
                                </div>
                            </div>
                            <div class="input-group form-group col-md-6 col-xs-6">
                                <input type="text" class="layui-input form-control no-bor-right no-bor-left" id="data6" name="shijianduan" placeholder="上课时间段" lay-key="12" style="border-right: 1px solid #ccc;">
                            </div>
                        </div>
                        <div class="col-md-4 col-xs-4" >
                            <div class="input-group form-group col-md-5  col-xs-5">
                                <div class="btn-group">
                                <span type="button" class="dropdown-toggle form-control"  style="border-right: 0;text-align: center;margin-left: -3px">
                                    活动：
                                </span>
                                </div>
                            </div>
                            <div class="input-group form-group col-md-7  col-xs-7">
                                <div class="btn-group">
                                    <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown"
                                            style="border-left: 0;margin-left: -4px">
                                        <span class="title">活动名称</span> <span class="caret"></span>
                                        <input type="hidden" name="activity">
                                    </button>
                                    <ul class="dropdown-menu dropdown-select" role="menu">
                                        <li><a href="javascript:;" id="">未填写</a></li>
                                        {volist name='activity' id='data'}
                                        <li><a href="javascript:;" id="{$data.id}">{$data.title}</a></li>
                                        {/volist}
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <!---->

                    </div>
                    <div class="col-xs-12">
                        <div class="col-md-4 col-xs-4">
                            <div class="input-group form-group col-md-5  col-xs-5">
                                <div class="btn-group" style="line-height: 20px;">
                                    <span type="button" class="dropdown-toggle form-control"  style="border-right: 0 !important;text-align: center;">
                                        拍摄方式：
                                    </span>
                                </div>
                            </div>
                            <div class="input-group form-group col-md-7 col-xs-7">
                                <div class="btn-group">
                                    <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" style="border-left: 0;">
                                        <span class="title">店内拍摄</span> <span class="caret"></span>
                                        <input type="hidden" name="shot_mode" {if condition="$data.shot_mode != ''"}value="{$data.shot_mode}"{else/}value="48"{/if}>
                                    </button>
                                    <ul class="dropdown-menu dropdown-select" role="menu">
                                        {volist name='shotmode' id='info'}
                                        <li><a href="javascript:;" id="{$info.id}">{$info.title}</a></li>
                                        {/volist}
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <!--<div class="col-md-4  col-xs-4" style="margin-left: -1px;">-->
                        <!--<div class="input-group form-group col-md-6  col-xs-6">-->
                        <!--<div class="btn-group" style="line-height: 20px;">-->
                        <!--<span type="button" class="dropdown-toggle form-control"  style="border-right: 0 !important;text-align: center;">-->
                        <!--拍摄类别：-->
                        <!--</span>-->
                        <!--</div>-->
                        <!--</div>-->
                        <!--<div class="input-group form-group col-md-6  col-xs-6">-->
                        <!--<div class="btn-group">-->
                        <!--<button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" style="border-left: 0;">-->
                        <!--<span class="title">-->
                        <!--{eq name="data.leibie" value=""}-->
                        <!--未填写-->
                        <!--{else/}-->
                        <!--{$data.leibie_text}-->
                        <!--{/eq}-->
                        <!--</span> <span class="caret"></span>-->
                        <!--<input type="hidden" name="leibie" value="">-->
                        <!--</button>-->
                        <!--<ul class="dropdown-menu dropdown-select" role="menu">-->
                        <!--{volist name='leibie' id='info'}-->
                        <!--<li><a href="javascript:;" id="{$info.id}">{$info.title}</a></li>-->
                        <!--{/volist}-->
                        <!--</ul>-->
                        <!--</div>-->
                        <!--</div>-->
                        <!--</div>-->
                        <div class="col-md-4  col-xs-4" style="margin-left: -3px;">
                            <div class="input-group form-group col-md-5  col-xs-5">
                                <div class="btn-group" style="line-height: 20px;">
                                <span type="button" class="dropdown-toggle form-control"  style="border-right: 0 !important;text-align: center;">
                                    意向度：
                                </span>
                                </div>
                            </div>
                            <div class="input-group form-group col-md-7  col-xs-7">
                                <div class="btn-group">
                                    <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" style="border-left: 0;">
                                    <span class="title">
                                    {eq name="data.intention" value=""}
                                        未填写
                                    {else/}
                                        {$data.intention_text}
                                    {/eq}
                                    </span> <span class="caret"></span>
                                        <input type="hidden" name="intention" value="{$data.intention}">
                                    </button>
                                    <ul class="dropdown-menu dropdown-select" role="menu">
                                        <li><a href="javascript:;" id="">未填写</a></li>
                                        {volist name='yixiang' id='info'}
                                        <li><a href="javascript:;" id="{$info.id}">{$info.title}</a></li>
                                        {/volist}
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4 col-xs-4">
                            <div class="input-group form-group col-md-5  col-xs-5">
                                <div class="btn-group" style="line-height: 20px;">
                                <span type="button" class="dropdown-toggle form-control"  style="border-right: 0 !important;text-align: center;">
                                    预算：
                                </span>
                                </div>
                            </div>
                            <div class="input-group form-group col-md-7  col-xs-7">
                                <div class="btn-group">
                                    <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" style="border-left: 0;">
                                    <span class="title">
                                        {eq name="$data.budget" value=""}
                                            未填写
                                        {else/}
                                            {$data.budget_text}
                                        {/eq}
                                    </span> <span class="caret"></span>
                                        <input type="hidden" name="budget" value="{$data.budget}">
                                    </button>
                                    <ul class="dropdown-menu dropdown-select" role="menu">
                                        <li><a href="javascript:;" id="">未填写</a></li>
                                        {volist name='yusuan' id='info'}
                                        <li><a href="javascript:;" id="{$info.id}">{$info.title}</a></li>
                                        {/volist}
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4 col-xs-4" style="margin-left: -1px;">
                            <div class="input-group form-group col-md-6  col-xs-6">
                                <div class="btn-group" style="line-height: 20px;">
                                    <span type="button" class="dropdown-toggle form-control"  style="border-right: 0 !important;text-align: center;">
                                        预计拍摄时间：
                                    </span>
                                </div>
                            </div>
                            <div class="input-group form-group col-md-6 col-xs-6">
                                <input type="text" class="form-control no-bor-right no-bor-left"  name="shot_time" id="data4" placeholder="预计拍摄时间" style="border-right: 1px solid #ccc;">
                            </div>
                        </div>
                    </div>

                    <!---->
                    <div class="col-xs-12">
                        <div class="input-group form-group col-md-2 col-xs-2">
                            <div class="btn-group">
                                <span type="button" class="dropdown-toggle form-control"  style="height: 200px;text-align: center;border-right: none;line-height: 200px;padding: 0;border-right: 1px solid #CCCCCC;">
                                    推广备注
                                </span>
                            </div>
                        </div>
                        <div class="input-group col-md-10 col-xs-10" >
                            <div class="btn-group">
                                <textarea name="qdbz" style="height: 170px;width: 100%;resize: none;padding: 10px;outline: none;border: 1px solid #CCCCCC;border-left: 0;" placeholder="请输入推广备注" class="no-bor-left"></textarea>
                            </div>
                            <div class="col-md-12 col-xs-12 addinvit" >
                                <div class="col-md-5 col-xs-5">

                                </div>
                                <div class="col-md-2 col-xs-2">
                                    <input type="checkbox" id="urg" name="urgent" value="1" style="margin:0;">
                                    <label for="urg">加急&nbsp;<i class="fa fa-flash"></i></label>
                                </div>
                                <div class="col-md-5 col-xs-5" style="float: right;">
                                    <div class="btn-group">
                                        <select class="select_all invitgroup" name="yykf_group" id="group">
                                            <option value="0">选择邀约组</option>
                                            {volist name="yykf_group" id="info"}
                                            <option value="{$info.id}" {eq name="info.id" value="$depar" } selected {/eq}>{$info.name}</option>
                                            {/volist}
                                        </select>
                                        <select class="select_all " name="yykf" id="invit1">
                                            <option value="0">选择邀约人员</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!---->

                </form>

            </div>
            <div class="tab-pane fade" id="profile1">
                <form class="form-horizontal" role="form" id="res_form" >
                    <div class="alert-red" id="error_box0">
                    </div>
                    <input type="hidden" name="addtype" id="typs" value="2">
                    <!--<div class="col-xs-12">
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right" name="baby" placeholder="宝宝姓名">
                            <div class="input-group-addon" style="padding: 6px;">
                                <div class="btn-group">
                                    <button type="button" class="dropdown-toggle no-back" data-toggle="dropdown" style="border-left: 0;">
                                        <span class="title"><i class="fa fa-user-circle" aria-hidden="true"></i></span>
                                        <input type="hidden" name="b_gender">
                                    </button>
                                    <ul class="dropdown-menu sex" role="menu">
                                        <li><a href="javascript:;" id="0"><i class="fa fa-venus" aria-hidden="true"></i></a></li>
                                        <li><a href="javascript:;" id="1"><i class="fa fa-mars" aria-hidden="true"></i></a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right no-bor-left" name="birth" id="data1" placeholder="出身日期">
                            <div class="input-group-addon"><i class="fa fa-birthday-cake" aria-hidden="true"></i></div>
                        </div>
                    </div>-->
                    <!---->
                    <div class="col-xs-12" style="height: 15px;margin-top: 5px;">
                        <span style="color: #888;background-color: #fff;">主要联系人</span>
                        <div style="width: 100%;margin-top: -8px;border-top: 1px solid #ccc;"></div>
                    </div>
                    <div class="col-xs-12">
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right" name="o_user" placeholder="主要姓名">
                            <div class="input-group-addon" style="padding: 6px;">
                                <div class="btn-group">
                                    <button type="button"  class="dropdown-toggle no-back" data-toggle="dropdown" style="border-left: 0;">
                                        <span class="title"><i class="fa fa-question-circle-o" aria-hidden="true"></i></span>
                                        <input type="hidden" name="gender" value="{$data.spare_gender}">
                                    </button>
                                    <ul class="dropdown-menu sex" role="menu">
                                        <li><a href="javascript:;" id="0"><i class="fa fa-venus" aria-hidden="true"></i></a></li>
                                        <li><a href="javascript:;" id="1"><i class="fa fa-mars" aria-hidden="true"></i></a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right no-bor-left" name="o_phone" id="phone0" placeholder="主要电话">
                            <div class="input-group-addon"><i class="fa fa-phone" aria-hidden="true"></i></div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control  no-bor-right no-bor-left" name="o_wechat" id="wechat0" placeholder="主要微信">
                            <div class="input-group-addon"><i class="fa fa-wechat" aria-hidden="true"></i></div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control  no-bor-right no-bor-left" name="o_qq" placeholder="主要QQ">
                            <div class="input-group-addon"><i class="fa fa-qq" aria-hidden="true"></i></div>
                        </div>
                    </div>
                    <!---->
                    <div class="col-xs-12" style="height: 15px;margin-top: 5px;">
                        <span style="color: #888;background-color: #fff;">备用联系人</span>
                        <div style="width: 100%;margin-top: -8px;border-top: 1px solid #ccc;"></div>
                    </div>
                    <!---->
                    <div class="col-xs-12">
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control  no-bor-right" name="spare_user" placeholder="备用联系人">
                            <div class="input-group-addon" style="padding: 6px;">
                                <div class="btn-group">
                                    <button type="button"  class="dropdown-toggle no-back" data-toggle="dropdown" style="border-left: 0;">
                                        <span class="title"><i class="fa fa-question-circle-o" aria-hidden="true"></i></span>
                                        <input type="hidden" name="spare_gender" value="{$data.spare_gender}">
                                    </button>
                                    <ul class="dropdown-menu sex" role="menu">
                                        <li><a href="javascript:;" id="0"><i class="fa fa-venus" aria-hidden="true"></i></a></li>
                                        <li><a href="javascript:;" id="1"><i class="fa fa-mars" aria-hidden="true"></i></a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right no-bor-left" name="spare_phone" placeholder="备用电话">
                            <div class="input-group-addon"><i class="fa fa-phone" aria-hidden="true"></i></div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right no-bor-left" name="spare_wechat" placeholder="备用微信">
                            <div class="input-group-addon"><i class="fa fa-wechat" aria-hidden="true"></i></div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right no-bor-left" name="spare_qq" placeholder="备用QQ">
                            <div class="input-group-addon"><i class="fa fa-qq" aria-hidden="true"></i></div>
                        </div>
                    </div>
                    <!---->
                    <div class="col-xs-12" style="height: 15px;margin-top: 5px;">
                        <span style="color: #888;background-color: #fff;">推荐联系人</span>
                        <div style="width: 100%;margin-top: -8px;border-top: 1px solid #ccc;"></div>
                    </div>
                    <!---->
                    <div class="col-xs-12">
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right" name="rec_user" placeholder="推荐联系人">
                            <div class="input-group-addon" style="padding: 6px;">
                                <div class="btn-group">
                                    <button type="button"  class="dropdown-toggle no-back" data-toggle="dropdown" style="border-left: 0;">
                                        <span class="title"><i class="fa fa-question-circle-o" aria-hidden="true"></i></span>
                                        <input type="hidden" name="rec_gender" value="{$data.spare_gender}">
                                    </button>
                                    <ul class="dropdown-menu sex" role="menu">
                                        <li><a href="javascript:;" id="0"><i class="fa fa-venus" aria-hidden="true"></i></a></li>
                                        <li><a href="javascript:;" id="1"><i class="fa fa-mars" aria-hidden="true"></i></a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control no-bor-right no-bor-left" name="rec_phone" placeholder="推荐电话">
                            <div class="input-group-addon"><i class="fa fa-phone" aria-hidden="true"></i></div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control  no-bor-right no-bor-left" name="rec_wechat" placeholder="推荐微信">
                            <div class="input-group-addon"><i class="fa fa-wechat" aria-hidden="true"></i></div>
                        </div>
                        <div class="input-group form-group col-md-3 col-xs-3">
                            <input type="text" class="form-control  no-bor-right no-bor-left" name="rec_qq" placeholder="推荐QQ">
                            <div class="input-group-addon"><i class="fa fa-qq" aria-hidden="true"></i></div>
                        </div>
                    </div>
                    <div class="col-xs-12">
                        <div class="input-group form-group col-md-3  col-xs-3">
                            <div class="btn-group">
                                <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" style="border-right: 0 !important;">
                                    <span class="title">渠道</span>  <span class="caret"></span>
                                    <input type="hidden" name="channel" id="channel">
                                </button>
                                <ul class="dropdown-menu channels" role="menu">
                                    {volist name='channel' id='data' }
                                    <li><a href="javascript:;" id="{$data.id}">{$data.title}</a></li>
                                    {/volist}
                                </ul>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-2 col-xs-2">
                            <div class="btn-group">
                                <select name="source" id="source" class=" form-control">
                                    <option>来源</option>
                                </select>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-3  col-xs-3">
                            <div class="btn-group">
                                <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown"
                                        style="border-right: 0 !important;padding: 0;">
                                    <span class="title">活动名称</span> <span class="caret"></span>
                                    <input type="hidden" name="activity">
                                </button>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="javascript:;" id="">未填写</a></li>
                                    {volist name='activity' id='data' }
                                    <li><a href="javascript:;" id="{$data.id}">{$data.title}</a></li>
                                    {/volist}
                                </ul>
                            </div>
                        </div>
                        <!---->
                        <div class="input-group form-group col-md-2  col-xs-2">
                            <div class="btn-group">
                                <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown">
                                    <span class="title">拍摄类别</span> <span class="caret"></span>
                                    <input type="hidden" name="types">
                                </button>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="javascript:;" id="">未填写</a></li>
                                    {volist name='category' id='data'}
                                    <li><a href="javascript:;" id="{$data.id}">{$data.title}</a></li>
                                    {/volist}
                                </ul>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-2  col-xs-2">
                            <div class="btn-group">
                                <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown">
                                    <span class="title">意向度</span> <span class="caret"></span>
                                    <input type="hidden" name="intention">
                                </button>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="javascript:;" id="">未填写</a></li>
                                    {volist name='yixiang' id='data'}
                                    <li><a href="javascript:;" id="{$data.id}">{$data.title}</a></li>
                                    {/volist}
                                </ul>
                            </div>
                        </div>
                    </div>
                    <!---->
                    <div class="col-xs-12">
                        <div class="input-group form-group col-md-4 col-xs-4">
                            <div class="col-md-5 col-xs-5" style="padding-left: 0;padding-right: 0;">
                                <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" style="border-right: 0 !important;">
                                    <span class="title">地址</span> <i class="fa fa-map-marker"></i>
                                </button>
                            </div>
                            <div class="col-md-7 col-xs-7">
                                <div class="btn-group">
                                    <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" style="border-right: 0 !important;">
                                        <span class="title">省份</span> <span class="caret"></span>
                                        <input type="hidden" name="province">
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="javascript:;">A类</a></li>
                                        <li><a href="javascript:;">B类</a></li>
                                        <li><a href="javascript:;">C类</a></li>
                                        <li><a href="javascript:;">D类</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-2 col-xs-2">
                            <div class="btn-group">
                                <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" style="border-right: 0 !important;">
                                    <span class="title">城市</span> <span class="caret"></span>
                                    <input type="hidden" name="city">
                                </button>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="javascript:;">婚纱照</a></li>
                                    <li><a href="javascript:;">艺术照</a></li>
                                    <li><a href="javascript:;">母婴照</a></li>
                                    <li><a href="javascript:;">亲子照</a></li>
                                </ul>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-2 col-xs-2">
                            <div class="btn-group">
                                <button type="button" class="dropdown-toggle form-control" data-toggle="dropdown" >
                                    <span class="title">区县</span>  <span class="caret"></span>
                                    <input type="hidden" name="county">
                                </button>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="javascript:;">婚纱照</a></li>
                                    <li><a href="javascript:;">艺术照</a></li>
                                    <li><a href="javascript:;">母婴照</a></li>
                                    <li><a href="javascript:;">亲子照</a></li>
                                </ul>
                            </div>
                        </div>
                        <div class="input-group form-group col-md-4 col-xs-4">
                            <div class="layui-input-inline">
                                <input type="text" class="form-control no-bor-left"
                                       placeholder="详细地址" name="address"  >
                            </div>
                        </div>
                    </div>
                    <!---->
                    <div class="col-xs-12">
                        <div class="input-group form-group col-md-1 col-xs-1">
                            <div class="btn-group">
                                <button type="button" class="dropdown-toggle form-control"  style="height: 200px;">
                                    推广备注
                                </button>
                            </div>
                        </div>
                        <div class="input-group col-md-11 col-xs-11" >
                            <div class="btn-group">
                                <textarea name="service_note" style="height: 170px;width: 100%" class="no-bor-left"></textarea>
                            </div>
                            <div class="col-md-12 col-xs-12 addinvit" >
                                <div class="col-md-4 col-xs-4">

                                </div>
                                <div class="col-md-3 col-xs-3">
                                    <input type="checkbox" id="urg" name="urgent" value="1" style="margin:0;">
                                    <label for="urg">加急&nbsp;<i class="fa fa-flash"></i></label>
                                </div>

                                <div class="col-md-5 col-xs-5">
                                    <div class="btn-group">
                                        <select class="select_all invitgroup" name="yykf_group" id="group0">
                                            <option value="0">选择邀约组</option>
                                            {volist name="sondepar" id="info"}
                                            <option value="{$info.id}" {eq name="depar" name="$info.id" }fsfsf{/eq}>{$info.name}</option>
                                            {/volist}
                                        </select>
                                        <select class="select_all " name="yykf" id="invit10">
                                            <option value="0">选择邀约人员</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                    <!---->

                </form>

            </div>
        </div>

        <!---->
    </div>
    <div class="col-md-12 col-xs-12 btn_box">
        <button type="button" class="btn btn-primary">确定</button>
        <button type="button" class="btn btn-default" data-dismiss="modal" style="margin: 20px;">取消</button>
    </div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="__STATIC__/admin/assets/js/jquery.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="__STATIC__/admin/assets/js/vendor/bootstrap/bootstrap.min.js"></script>
<!--引入下拉表单-->
<script src="__STATIC__/admin/bootstrap-select/dist/js/bootstrap-select.js?2018"></script>
<!--引入时间插件-->
<script type="text/javascript" src="__STATIC__/common/laydate/laydate.js"></script>
<!--引入layer插件-->
<script type="text/javascript" src="__STATIC__/common/layer/layer.js"></script>
<!---->
<script type="text/javascript" src="__STATIC__/common/release/wangEditor.min.js"></script>

{include file="base/validate"}

<script>
    var phone_vile = /^(13[0-9]|14[5-9]|15[012356789]|166|17[0-8]|18[0-9]|19[8-9])[0-9]{8}$/;
    laydate.render({
        elem: '#data0',
        type: 'date'
    });
    laydate.render({
        elem: '#data1',
        type: 'date'
    });
    laydate.render({
        elem: '#data2',
        type: 'date'
    });
    laydate.render({
        elem: '#data3',
        type: 'date'
    });
    laydate.render({
        elem: '#data4',
        type: 'datetime'
    });


    laydate.render({
        elem: '#data6'
        ,type: 'time'
        ,range: true

    })

    $(function() {
        var id = "{$depar}";
        var obj = $('.invitgroup').next().attr('id');
        var user = "{$user_id}";
//        getuser(id,obj,user);

        $('.dropdown-menu li a').on('click',function () {
            $(this).addClass('active').parents('li').siblings().find('a').removeClass('active');
        });
        $('.dropdown-menu li a').on('mouseover',function () {
            $(this).addClass('active').parents('li').siblings().find('a').removeClass('active');
        });

        //添加默认选中第一个渠道
        $('.select-li').eq(0).attr('selected','selected');

        /*调用父窗口的方法*/
        //验证主顾客手机重复
        $('[name="phone_z"]').on('blur',function () {
            var phone_z = $(this).val();
            var name = 'phone_z|phone_f|wechat|qq';
            window.parent.frames.validatorInfo(name,phone_z);
        });
        //验证备顾客手机重复
        $('[name="phone_f"]').on('blur',function () {
            var phone_f = $(this).val();
            var name = 'phone_z|phone_f|wechat|qq';
            window.parent.frames.validatorInfo(name,phone_f);
        });
        //验证微信重复
        $('[name="wechat"]').on('blur',function () {
            var wechat = $(this).val();
            var name = 'phone_z|phone_f|wechat|qq';
            window.parent.frames.validatorInfo(name,wechat);
        });
        //验证qq重复
        $('[name="qq"]').on('blur',function () {
            var qq = $(this).val();
            var name = 'phone_z|phone_f|wechat|qq';
            window.parent.frames.validatorInfo(name,qq);
        });
    });

    /*点击取消按钮*/
    $('.btn-default').click(function () {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭
    });

    $('.invitgroup').change(function () {
        var id = $(this).val();
        var obj = $(this).next().attr('id');
        getuser(id,obj);
    });

    /*获取对应的邀约组员*/
    function getuser(id,obj,user) {
        $.post("{:url('common/getuserByGroup')}",{depart_id:id},function(result){
            var html = '';
            $('#'+obj).html('');
            if(id == '0'){
                html += "<option value='0'>选择邀约人员</option>";
            }else {
                if(result.length ==0){
                    html += "<option  disabled>暂无邀约人员</option>";
                }else {
                    for (var i in result) {
                        if(user == result[i].id){
                            html += "<option value="+result[i].id+" selected >"+result[i].username+"</option>"
                        }else {
                            html += "<option value="+result[i].id+">"+result[i].username+"</option>"
                        }

                    }
                }

            }
            $('#'+obj).append(html);
        });
    }

    //邀约人员获取
    function groupinvit(id, obj ,invit){
        $.post("{:url('common/getuserByGroup')}", {depart_id: id}, function (result) {
            var html = '';
            obj.html('');
            if (id == '0') {
                html += "<option >未分配邀约</option>";
            } else {
                if(result.length !=0){
                    for (var i in result) {
                        if (invit == result[i].id) {
                            html += "<option value='" + result[i].id + "' selected  >" + result[i].username + "</option>";
                        } else {
                            html += "<option value='" + result[i].id + "'>" + result[i].username + "</option>";
                        }
                    }
//                    $.each(eval(result), function (i, n) {
//                        $("<option value='" + n.id + "'>" + n.title + "</optinon>").appendTo(obj);
//                    });
                }else {
                    html += "<option disabled>暂无邀约人员</option>";
                }

            }
            obj.append(html);
        });

    }

    /*数据校验*/
    var fields ={
        name_z: {
            message: '用户名验证失败',
            validators: {
                notEmpty: {
                    message: '主要联系人不能为空'
                }
            }
        },
        phone_z: {
            message: 'The phone is not valid',
            validators: {
                regexp: {
                    regexp: phone_vile,
                    message: '请输入正确的手机号码'
                },
//                threshold :  10 ,
//                remote: {
//                    type: "post",
//                    url: '{:url(\'getContact\')}',
//                    message: '当前号码已经存在',
//                    delay: 1000,
//                    data: function (validator) {
//                        return {
//                            name: "phone_z|phone_f|wechat|qq",
//                            value: $('[name="phone_z"]').val()
//                        };
//                    }
//                }
            }
        },
        wechat: {
            message: 'The phone is not valid',
            validators: {
//                threshold :  6 ,
//                remote: {
//                    type: "post",
//                    url: '{:url(\'getContact\')}',
//                    message: '当前微信已经存在',
//                    delay: 2000,
//                    data: function(validator) {
//                        return {
//                            name: "phone_z|phone_f|wechat|qq",
//                            value: $('[name="wechat"]').val()
//                        };
//                    }
//                }
            }
        },
        phone_f: {
            message: 'The phone is not valid',
            validators: {
                regexp: {
                    regexp: phone_vile,
                    message: '请输入正确的手机号码'
                },
//                threshold :  10 ,
//                remote: {
//                    type: "post",
//                    url: '{:url(\'getContact\')}',
//                    message: '当前号码已经存在',
//                    delay: 1000,
//                    data: function(validator) {
//                        return {
//                            name: "phone_z|phone_f|wechat|qq",
//                            value: $('[name="phone_f"]').val()
//                        };
//                    }
//                },
                different: {
                    //不能和用户名相同
                    field: 'phone_z',
                    //需要进行比较的input name值
                    message: '不能和主电话相同'
                }

            }
        },
        qq: {
            message: 'The phone is not valid',
            validators: {
                regexp: {
                    regexp: /^[1-9][0-9]{4,14}$/,
                    message: '请输入正确的QQ号码'
                },
//                threshold :  10 ,
//                remote: {
//                    type: "post",
//                    url: '{:url(\'getContact\')}',
//                    message: '当前QQ号码已经存在',
//                    delay: 1000,
//                    data: function (validator) {
//                        return {
//                            name: "phone_z|phone_f|wechat|qq",
//                            value: $('[name="qq"]').val()
//                        };
//                    }
//                }
            }
        },
    }
    }
//    $('.channels').find('li a').click(function () {
//        $('#channel').val($(this).attr('id'));
//        var channel = $('#channel').val();
//        var obj = $('#source');
//        getsource(channel,obj);
//    });
//    $('.cheannele').find('li a').click(function () {
//        $('#channels').val($(this).attr('id'));
//        var channel = $('#channels').val();
//        var obj = $('#source0');
//        getsource(channel,obj);
//    });
    //联动来源
    $('#channels').on('hidden.bs.select',function () {
        var channel = $(this).selectpicker('val');
        var obj = $('#source0');
        getsource(channel,obj);
    });

    /*根据渠道获取来源*/
    function getsource(data,obj) {
        if(data != '') {
            $.post("{:url('common/getSourceByChennel')}", {channel: data}, function (result) {
                var html = "";
                obj.html('');
                if (result == '') {
                    html += "<option value='0' selected='selected'>暂无来源</option>";
                    $('#banjishow').hide();
                    $('#xingqi').hide();
                    $('#shangkeriqi').hide();
                    obj.append(html);
                } else {
                    // $("<option value=0 selected='selected'>来源</optinon>").appendTo(obj);
                    $.each(eval(result), function (i, n) {
                        $("<option value='" + n.id + "' selected='selected' >" + n.title + "</optinon>").appendTo(obj);
                    });
                }
                var banji = $('#banji');
                $.post("{:url('common/getBanjiBySource')}", {source: data}, function (result) {
                    var html = "";
                    banji.html('');
                    // console.log(result);
                    // console.log(result);
                    // return false;
                    if (result == '') {
                        $('#banjishow').hide();
                        $('#xingqi').hide();
                        $('#shangkeriqi').hide();
                        html += "<option value='0' selected='selected'>暂无班级</option>";
                        banji.append(html);
                    }else if(result.code==0){
                        return false;
                    } else {
                        $('#banjishow').show();
                        $('#xingqi').show();
                        $('#shangkeriqi').show();
                        $.each(eval(result), function (i, n) {
                            $("<option value='" + n.id + "' selected='selected'>" + n.banjiname + "</optinon>").appendTo(banji);
                        });
                    }
                })

            });
        }
    }
    // $('#source0').on('change',function () {
    //     var source = $(this).val();
    //     var banji = $('#banji');
    //     //     // getbanji(channel,banji);
    //     if(channel != '') {
    //         $.post("{:url('common/getBanjiBySource')}", {source: source}, function (result) {
    //             if(result.wait==3){
    //                 layer.msg(result.msg, {icon: data.status});
    //                 return false;
    //             }
    //             if (result.role==0){
    //                 layer.msg(result.msg, {icon: data.status});
    //                 return false;
    //             }
    //             var html = "";
    //             banji.html('');
    //             // console.log(result);
    //             if (result == '') {
    //                 $('#banjishow').hide();
    //                 html += "<option value='0' selected='selected'>暂无班级</option>";
    //                 banji.append(html);
    //             } else {
    //                 $('#banjishow').show();
    //                 $.each(eval(result), function (i, n) {
    //                     // console.log(n);
    //                     $("<option value='" + n.id + "' selected='selected'>" + n.banjiname + "</optinon>").appendTo(banji);
    //                 });
    //             }
    //         });
    //     }
    // });

    /*下拉菜单事件*/
    $('.dropdown-toggle').next('.dropdown-menu').find('li a').click(function () {
        $(this).parent().parent().prev('.dropdown-toggle').find('.title').html($(this).html());
        var identification = $(this).prop('id');
        $(this).parent().parent().prev('.dropdown-toggle').find('input').val(identification);
    });

    $(function(){
        var channelid = "{$channel[0]['id']}";
        var obj = $('#source0');
        getsource(channelid,obj);

        $('#ser_form').bootstrapValidator({
            message: '',
            fields: fields
        });
        //推荐客资校验
        $('#res_form').bootstrapValidator({
            message: '',
            fields: fields
        });
        /*保存数据*/
        $(".btn-primary").on("click", function () {
            var form = $('.btn-primary').parent('.btn_box').prev('.panel-body');
            var formid=form.find('.tab-content').find('.active').find('form').attr('id');
            var formData = new FormData($("#"+formid)[0]);
            var bootstrapValidator = $("#"+formid).data('bootstrapValidator');
            bootstrapValidator.validate();
            if (bootstrapValidator.isValid()) {
                if(formid=='ser_form'){
                    if(!$('#phone').val() && !$('#wechat').val()){
                        return layer.msg("联系人电话或微信必填其一", {icon: 0});
                    }
                }
//                if(formid=='res_form'){
//                    if(!$('#phone0').val() && !$('#wechat0').val()){
//                        return layer.msg("联系人电话或微信必填其一", {icon: 0});
//                    }
//                    if(!$("[name='rec_phone']").val() && !$("[name='rec_wechat']").val()){
//                        return layer.msg("推荐人电话或微信必填其一", {icon: 0});
//                    }
//                }
                $.ajax({
                    type: "POST",
                    url:  "{:url('add')}",
                    data: formData,
                    async: false,
                    cache: false,
                    contentType: false,
                    processData: false,
                    beforeSend:function(){
                        $('.btn-primary').attr("disabled","false"); //禁止点击
                    },
                    success: function(data){
                        layer.msg(data.info, {icon: data.status});
                        setTimeout(function(){
                            $('.btn-primary').attr("disabled","false"); //禁止点击
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            window.parent.location.reload();
                        },2000); //延迟演示
                    }
                });
                return false;
            } else return;
        });
    });
</script>
</body>
</html>